<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../node_modules/jquery/dist/jquery.js"></script>
</head>

<body>
    <button id="btn">点击</button>
    <script>
        var timer = null

        $('#btn').click(function() {
            if (timer) {
                return
            }
            timer = setTimeout(function() {
                console.log(1);
                timer = null
            }, 2000)
        })
    </script>
</body>

</html>